package org.ala.tcp_feign_common.msg.heart;

import org.ala.tcp_feign_common.enums.TcpFeignMessageTypeEnums;
import org.ala.tcp_feign_common.msg.AbstractByteMessage;


/**
 * 心跳消息
 * 
 * [0x03 | 消息总长(4字节) | 心跳时间戳(8字节)]
 * 
 * @author 骆毅(ala)
 * @date 2024年4月19日
 */
public class HeartByteMessage extends AbstractByteMessage {
	private static final long serialVersionUID = 1L;

	
	/**
	 * 发送心跳时间戳
	 */
	protected long timestamp;
	
	
	public static HeartByteMessage build() {
		HeartByteMessage msg = new HeartByteMessage();
		msg.setTimestamp(System.currentTimeMillis());
		return msg;
	}
	
	
	@Override
	public TcpFeignMessageTypeEnums type() {
		return TcpFeignMessageTypeEnums.HEART;
	}


	public long getTimestamp() {
		return timestamp;
	}


	public void setTimestamp(long timestamp) {
		this.timestamp = timestamp;
	}
	
}
